/* 
 * Cashbox is the legal property of its developers, whose names are listed in the copyright file included
 * with this source distribution.
 * 
 * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
 * General Public License as published by the Free Software Foundation; either version 2 of the License,
 * or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 * Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License along with this program; if not,
 * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */

#import "CBViewController.h"

enum {
	CBImportViewControllerImportButton,
	CBImportViewControllerCompleteButton,
	CBImportViewControllerContinueButton
};
typedef NSUInteger CBImportViewControllerContinueButtonType;

enum {
	CBImportViewControllerCancelButton,
	CBImportViewControllerGoBackButton
};
typedef NSUInteger CBImportViewControllerGoBackButtonType;

@class CBImporter, CBImportLabel;
@interface CBImportViewController : CBViewController {
	id delegate;
	CBImporter *importer;
	NSArray *colors;
	NSArray *colorTitles;

	IBOutlet NSView *tabViewContainer;
	IBOutlet NSTableView *accountsTable;
	IBOutlet NSTableView *labelsTable;
	IBOutlet NSTabView *tabView;
	IBOutlet NSMenu *colorMenu;
	IBOutlet FSColoredMenuItem *otherMenuItem;
	IBOutlet NSButton *alterDatesSwitch;
	IBOutlet NSTextField *errorTextField;
	
	
	IBOutlet NSView *progressView;
	IBOutlet NSTextField *progressTitle;
	IBOutlet NSProgressIndicator *progressIndicator;
	
	NSColorPanel *panel;
	CBImportLabel *selectedLabel;
	
	NSView *willShowView;
	
	BOOL setup;
	int currentTabIndex;
	int previousTabIndex;
	int nextTabIndex;
}

- (CBImporter *)importer;
- (void)setImporter:(CBImporter *)importer;

- (id)delegate;
- (void)setDelegate:(id)delegate;

- (BOOL)canRespond;
- (NSSize)preferredContentSize;

- (BOOL)firstScreen;
- (BOOL)lastScreen;

// types of buttons that should be displayed
- (CBImportViewControllerContinueButtonType)continueButton;
- (CBImportViewControllerGoBackButtonType)goBackButton;

- (void)showPreviousScreen:(id)sender; // goes back action... can invoke cancel delegate method
- (void)showNextScreen:(id)sender; // goes forward action... can invoke complete and import delegate methods

// the rest are for IB use only

- (IBAction)colorChange:(id)sender;
- (IBAction)showColorPanel:(id)sender;

- (IBAction)doNotDisplayQIFOptionsAgainClick:(id)sender;
- (IBAction)moreInformationClick:(id)sender;

@end

@interface NSObject (CBImportViewControllerDelegate)

// called when all the screens have been completed (including any error screens)
- (void)importViewControllerHasCompletedAllScreens:(CBImportViewController *)controller;
// called when all the screens asking about importing have been completed.
// the view is still in use at this point to show progress (and possibly show errors)
- (void)importViewControllerAcceptedImport:(CBImportViewController *)controller;
// called when canceling
- (void)importViewControllerDidCancel:(CBImportViewController *)controller;

@end

// these notifications are used for observing changes between the progress
// and standard views
extern NSString *CBImportViewControllerWillShowProgressViewNotification;
extern NSString *CBImportViewControllerDidShowProgressViewNotification;
extern NSString *CBImportViewControllerWillShowStandardViewNotification;
extern NSString *CBImportViewControllerDidShowStandardViewNotification;

// these notifications are used for observing changes from one screen
// to the next
extern NSString *CBImportViewControllerWillChangeScreenNotification;
extern NSString *CBImportViewControllerDidChangeScreenNotification;
